Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

More params + user_payload for domains_create, add returns to method calls, add type annotations + more #32

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

Someguy123
Copy link

This pull request includes a wide variety of improvements and additions to PyNamecheap, which makes the library more IDE friendly (type annotations), and more flexible (user specifiable extra payload kwargs + return response data everywhere)

I have not touched the version in setup.py as I'm not a maintainer for PyNamecheap, and you may want to merge in multiple PRs to make up the 0.0.4 release.

I've noticed the main namecheap.py file hasn't been updated in several years, so just in-case this project is abandoned, we'll be maintaining and publishing our fork of this library here: https://github.com/Privex/PyNamecheap


Notable changes in this pull request

  • Added OrganizationName, JobTitle, PromotionCode, and Nameservers to Api.domains_create, which allow registering domains with a company, and allow setting nameservers immediately while purchasing a domain.

  • Added **user_payload to Api.domains_create, which allows users to specify custom payload keys that aren't yet implemented, or override payload keys which were auto-generated by the function (e.g. WGEnabled, RegistrantEmailAddress etc.)

  • Added helper methods get_element and get_element_dict for working with XML objects

  • Added self.get_element_dict() return values to domain_create, domains_dns_setDefault, domains_dns_setHosts, domains_dns_setCustom, domains_dns_addHost, and domains_dns_delHost

    • This allows users of the library to be able to actually interpret the command response from Namecheap. While most commands just return the domain name and IsSuccess / Updated etc., some commands such as domains_create return a lot of useful data, such as the amount that the domain costed, IDs for the domain / transaction / order, whether WhoisGuard was enabled, whether or not a free PostiveSSL certificate was claimed etc.
  • Added type annotations to most Api methods. Used the Python 2.x / early 3.x compatible # type: () -> xxx format, as I'm unsure what versions of Python that PyNamecheap is aiming to support.

  • Updated namecheap_tests.py to validate the new dict return values from methods such as domain_create

  • Added requests and nose to requirements.txt to simplify dependency installation in a dev environment

 - Added `OrganizationName`, `JobTitle`, `PromotionCode`, and `Nameservers` to `Api.domains_create`, which allow registering domains with a company, and allow setting nameservers immediately while purchasing a domain.

 - Added `**user_payload` to `Api.domains_create`, which allows users to specify custom payload keys that aren't yet implemented, or override payload keys which were auto-generated
   by the function (e.g. ``WGEnabled``, `RegistrantEmailAddress` etc.)

 - Added helper methods `get_element` and `get_element_dict` for working with XML objects

 - Added `self.get_element_dict()` return values to `domain_create`, `domains_dns_setDefault`, `domains_dns_setHosts`, `domains_dns_setCustom`, `domains_dns_addHost`, and `domains_dns_delHost`
    - This allows users of the library to be able to actually interpret the command response from Namecheap. While most commands just return the domain name and `IsSuccess` / `Updated` etc.,
      some commands such as `domains_create` return a lot of useful data, such as the amount that the domain costed, IDs for the domain / transaction / order, whether WhoisGuard was
      enabled, whether or not a free PostiveSSL certificate was claimed etc.

 - Added type annotations to most `Api` methods. Used the Python 2.x / early 3.x compatible `# type: () -> xxx` format, as I'm unsure what versions of Python that PyNamecheap
   is aiming to support.

 - Updated `namecheap_tests.py` to validate the new `dict` return values from methods such as `domain_create`

 - Added `requests` and `nose` to `requirements.txt` to simplify dependency installation in a dev environment
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant